package com.boyunv.observer.example01;
/*
 *@description
 *
 *@author boyunv
 *@create 2023/8/8 7:27
 *@version 1.0
 */

public class Client {
 public static void main(String[] args) {
  //获取工厂对象
  FlyweightFactory factory=new FlyweightFactory();
  //通过工厂对象获取共享的享元对象
  Flyweight a1 = factory.getFlyweight("A");
  a1.operation("a1Exstate");
  Flyweight a2 = factory.getFlyweight("A");
  a2.operation("a2Exstate");
  System.out.println(a1==a2);

  //获取非共享的享元对象

  UnSharedFlyweight u1= new UnSharedFlyweight("A");
  UnSharedFlyweight u2= new UnSharedFlyweight("A");
  System.out.println(u1==u2);


 }
}
